##Code to produce opponents variable.

setwd("/Users/Allan/Dropbox/1Papers/1Reputation/Honor-Culture-War/2012-05/Replication-Final/")
d <- read.csv("1-Original-Data/MID-level/MIDB_4.01.csv")

#Variables listing all countries on the same 
d$Opps <- rep("",length(d[,1]))

uniqueDispNum3 <- unique(d$DispNum3)
#List all countries on the opposite side
for (i in uniqueDispNum3){
  for (j in 0:1) {
    d$Opps[d$DispNum3==i & d$SideA==j] <-  toString(d$StAbb[d$DispNum3==i & d$SideA==(1-j)])
  }                                                      
  print(i)
} 


write.table(d, file = "1-Original-Data/MIDB_4.01-2.csv", sep=",", row.names=FALSE)

